﻿namespace Microsoft.SharePoint.Client
{
    using System;
    using System.ComponentModel;

    [ScriptType("SP.FieldMultiLineText", ServerTypeId="{9ae17ecc-11a6-4433-8b51-7ecb865ffe05}")]
    public class FieldMultiLineText : Field
    {
        [EditorBrowsable(EditorBrowsableState.Never)]
        public FieldMultiLineText(ClientRuntimeContext Context, ObjectPath ObjectPath) : base(Context, ObjectPath)
        {
        }

        protected override bool InitOnePropertyFromJson(string peekedName, JsonReader reader)
        {
            bool flag = base.InitOnePropertyFromJson(peekedName, reader);
            if (!flag)
            {
                string str = peekedName;
                if (str == null)
                {
                    return flag;
                }
                if (!(str == "WikiLinking"))
                {
                    if (str == "NumberOfLines")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["NumberOfLines"] = reader.ReadInt32();
                        return flag;
                    }
                    if (str == "AllowHyperlink")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["AllowHyperlink"] = reader.ReadBoolean();
                        return flag;
                    }
                    if (str == "RestrictedMode")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["RestrictedMode"] = reader.ReadBoolean();
                        return flag;
                    }
                    if (str == "RichText")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["RichText"] = reader.ReadBoolean();
                        return flag;
                    }
                    if (str == "AppendOnly")
                    {
                        flag = true;
                        reader.ReadName();
                        base.ObjectData.Properties["AppendOnly"] = reader.ReadBoolean();
                    }
                    return flag;
                }
                flag = true;
                reader.ReadName();
                base.ObjectData.Properties["WikiLinking"] = reader.ReadBoolean();
            }
            return flag;
        }

        [Remote]
        public bool AllowHyperlink
        {
            get
            {
                base.CheckUninitializedProperty("AllowHyperlink");
                return (bool) base.ObjectData.Properties["AllowHyperlink"];
            }
            set
            {
                base.ObjectData.Properties["AllowHyperlink"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "AllowHyperlink", value));
                }
            }
        }

        [Remote]
        public bool AppendOnly
        {
            get
            {
                base.CheckUninitializedProperty("AppendOnly");
                return (bool) base.ObjectData.Properties["AppendOnly"];
            }
            set
            {
                base.ObjectData.Properties["AppendOnly"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "AppendOnly", value));
                }
            }
        }

        [Remote]
        public int NumberOfLines
        {
            get
            {
                base.CheckUninitializedProperty("NumberOfLines");
                return (int) base.ObjectData.Properties["NumberOfLines"];
            }
            set
            {
                if (base.Context.ValidateOnClient)
                {
                    if (value < 1)
                    {
                        throw ClientUtility.CreateArgumentException("value");
                    }
                    if (value > 0x3e8)
                    {
                        throw ClientUtility.CreateArgumentException("value");
                    }
                }
                base.ObjectData.Properties["NumberOfLines"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "NumberOfLines", value));
                }
            }
        }

        [Remote]
        public bool RestrictedMode
        {
            get
            {
                base.CheckUninitializedProperty("RestrictedMode");
                return (bool) base.ObjectData.Properties["RestrictedMode"];
            }
            set
            {
                base.ObjectData.Properties["RestrictedMode"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "RestrictedMode", value));
                }
            }
        }

        [Remote]
        public bool RichText
        {
            get
            {
                base.CheckUninitializedProperty("RichText");
                return (bool) base.ObjectData.Properties["RichText"];
            }
            set
            {
                base.ObjectData.Properties["RichText"] = value;
                if (base.Context != null)
                {
                    base.Context.AddQuery(new ClientActionSetProperty(this, "RichText", value));
                }
            }
        }

        [Remote]
        public bool WikiLinking
        {
            get
            {
                base.CheckUninitializedProperty("WikiLinking");
                return (bool) base.ObjectData.Properties["WikiLinking"];
            }
        }
    }
}

